package com.net.framework.help.dialog;

import android.content.Context;

import com.net.framework.help.progress.ProgressCancelListener;
import com.net.framework.help.progress.ProgressDialogHandler;

/**
 * Author：xiaobin.zhang
 * Email：452331763@qq.com
 * Date：2019/7/29 16:43
 * Desc：<-一般加载弹窗->
 */
public class CommonProgressDialog implements ProgressCancelListener {

    private ProgressDialogHandler mProgressDialogHandler;

    private static class SingletonHolder {
        private static final CommonProgressDialog INSTANCE = new CommonProgressDialog();
    }

    public static CommonProgressDialog getInstance() {
        return CommonProgressDialog.SingletonHolder.INSTANCE;
    }

    public void showProgressDialog(Context mContext) {
        mProgressDialogHandler = new ProgressDialogHandler(mContext, this, true);
        mProgressDialogHandler.obtainMessage(ProgressDialogHandler.SHOW_PROGRESS_DIALOG).sendToTarget();
    }

    public void dismissProgressDialog() {
        if (mProgressDialogHandler != null) {
            mProgressDialogHandler.obtainMessage(ProgressDialogHandler.DISMISS_PROGRESS_DIALOG).sendToTarget();
            mProgressDialogHandler = null;
        }
    }

    @Override
    public void onCancelProgress() {

    }
}
